<?php

namespace App\Http\Controllers\Api\V1\Resources;

use Illuminate\Http\Resources\Json\JsonResource;

class GoldBeanResource extends JsonResource
{
    public function toArray($request)
    {
    	$resource = $this->resource;

        return [
        	'id' => (int)$resource->id,
	        'user_id' => (int)$resource->user_id,
	        'beans' => $resource->money ?? 0,
	        'reason' => $resource->reason,
	        'data' => $resource->data,
	        'created_at' => (string)$resource->created_at,
        ];
    }
}
